package book;

//书架
public class Bookshelf {
    private Book[] books;
    private int usedSize;//记录下标

    public Bookshelf() {
        this.books = new Book[10];
        //默认放10本书
        this.books[0] = new Book("三国演义","罗贯中",10,"小说");
        this.books[1] = new Book("水浒传","施耐庵",13,"小说");
        this.books[2] = new Book("西游记","吴承恩",29,"小说");
        //默认三本书
        this.usedSize = 3;

    }

    public int getUsedSize() {
        return usedSize;
    }

    public void setUsedSize(int usedSize) {
        this.usedSize = usedSize;
    }

    //获取一个下标的书
    public Book getBook(int pos) {
        return books[pos];
    }

    //放入pos下标的书
    public void setBooks(int pos, Book book) {
        books[pos] = book;
    }

    //为了获取最大容量
    public Book[] getBooks() {
        return books;
    }
}
